package com.xgpro.domain.rolemanage.entity;

import lombok.Data;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * @program: xgpro__dev
 * @Description: 角色
 * @Author: wangyang
 * @Date: 2019-09-07 16:57
 **/


@Data
@Table(name="t_role")
public class Role implements Serializable {

    @Id
    @KeySql(useGeneratedKeys = true)
    @GeneratedValue(generator = "JDBC")
    private Integer id;

    /**
     *角色名称
     */
    private String roleName;

    /**
     * 角色描述
     */
    private String description;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 权限列表
     */
    private Set<Permissions> permissions;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Role role = (Role) o;
        return Objects.equals(id, role.id) &&
                Objects.equals(roleName, role.roleName) &&
                Objects.equals(description, role.description) &&
                Objects.equals(createTime, role.createTime) &&
                Objects.equals(permissions, role.permissions);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, roleName, description, createTime, permissions);
    }
}